fix: prevent transitive ThisAssembly.Constants deps from copying assemblies to output#392
Merged
Conversation
…mblies to output Fixes #389 The change ensures that the runtime assemblies brought in by ThisAssembly.Constants (System.Runtime.CompilerServices.Unsafe.dll and System.Threading.Tasks.Extensions.dll) are not copied into the consumer's build output folder, by restricting the package reference assets to build/analyzers only (and enforcing via buildTransitive). - Updated authoring PackageReference - Added PackageReference Update in buildTransitive + buildMultiTargeting - Updated changelog
The bare 'dnx' command was not found in the pwsh-invoked test steps in GHA (despite the dotnet-env setup), causing build job failures. Using the explicit 'dotnet dnx' form (which the local env also exposes) makes the test step robust across shells and runners. This is incidental to the main fix but required to get green CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #389
Problem
Assemblies from transitive dependencies of ThisAssembly.Constants (
System.Runtime.CompilerServices.Unsafe.dllandSystem.Threading.Tasks.Extensions.dll) were being placed into the consumer project's build output folder, even when using the recommendedPrivateAssets="all"on the GitInfo package reference (and even on modern .NET Framework targets like net472).This started happening in 3.2.0 when GitInfo began depending on ThisAssembly.Constants to generate the
ThisAssembly.Git.*constants.Solution
buildandanalyzersassets.PackageReference Updaterules inbuildTransitiveandbuildMultiTargetingtargets to enforcePrivateAssets="all" IncludeAssets="build;analyzers"on ThisAssembly.Constants for all consumers of GitInfo.The generated package dependency now declares the limited assets, and the update rules ensure enforcement.
Verified:
bin/output (no unwanted DLLs) on net472 repros, with and without PrivateAssets on GitInfo ref.ThisAssembly.Git.*constants continue to generate and function correctly.